home *** CD-ROM | disk | FTP | other *** search
/ User's Choice Windows CD / User's Choice Windows CD (CMS Software)(1993).iso / windows2 / hp22d3.zip / REFGUIDE / COMMANDS.TXT < prev    next >
Text File  |  1991-05-16  |  80KB  |  2,473 lines

  1.  
  2.  
  3.  
  4.  
  5.     ________________________________________________________________________
  6.                                                Chapter 11: Commands   99
  7.     ________________________________________________________________________
  8.  
  9.  
  10.     CHAPTER ELEVEN: COMMANDS
  11.  
  12.     This chapter provides an alphabetical listing of all the commands
  13.     available in PADtalk. Each command is described in detail, its syntax is
  14.     given and examples are offered.
  15.  
  16.     Command:                Description:
  17.     -----------------------------------------------------------------------
  18.     add                     Add to a container
  19.     answer                  Ask a question with buttons as choices
  20.     ask                     Ask a question, allowing user to type response
  21.     close                   Close a file
  22.     convert                 Convert date and time data to a different format
  23.     delete                  Delete a chunk from a container
  24.     dial                    Dial a number with a modem
  25.     divide                  Divide a container by an amount
  26.     do                      Execute an expression as a statement
  27.     edit script             Edit the script of a HyperPAD object
  28.     find                    Find text somewhere in your pad
  29.     flushCache              Write changed pages from memory to disk
  30.     fxShow                  Execute the Show Partner F/X runtime
  31.     get                     Put an expression into the local variable "it"
  32.     global                  Declare a global variable
  33.     go                      Change to another page, background, or pad
  34.     hide                    Hide an object
  35.     hilite                  Highlights text in a field
  36.     multiply                Multiply a container by an amount
  37.     noSound                 Turn the speaker off (from sound or play)
  38.     play                    Play music in the background
  39.     playBack                Play back previously recorded keystrokes
  40.     pop page                Change to a previously saved page
  41.     print                   Print information from a pad
  42.  
  43.  
  44.  
  45.     ________________________________________________________________________
  46.                                                Chapter 11: Commands   100
  47.     ________________________________________________________________________
  48.  
  49.  
  50.     Command:                Description:
  51.     -----------------------------------------------------------------------
  52.  
  53.     push page               Save a page for later recovery using pop
  54.     put                     Copy information to a container
  55.     query                   Create a subset of pages based on criteria
  56.     read                    Read chunks from a file
  57.     record                  Record keystrokes for later playback
  58.     run                     Run another program
  59.     send                    Send a message to another object
  60.     set                     Modify object properties
  61.     setDefaultPopupColors   Sets the popup colors to the default
  62.     SetPopupColors          Sets the colors used to display popups
  63.     show                    Make an object visible
  64.     sort                    Sort the pad
  65.     sound                   Turn the speaker on a a particular frequency
  66.     subtract                Subtract an expression from a container
  67.     visual                  Set up an effect for the next page change
  68.     wait                    Wait some number of miliseconds
  69.     write                   Write text to a file
  70.  
  71.     -----------------------------------
  72.     ADD
  73.  
  74.     Syntax:
  75.     add <expression> to <destination>;
  76.  
  77.     Purpose: The add command adds the value of the expression to the value
  78.     of the destination and places the result into the destination.
  79.  
  80.     The <expression> must evaluate to a number or be a container holding a
  81.     number. The <destination> must be a container.
  82.  
  83.     Note: You will receive a runtime error if either the <expression> or the
  84.     <destination> is not a number.
  85.  
  86.     Examples:
  87.  
  88.     add 5 to page field 23;
  89.  
  90.     add 45.67 to word 2 of page field 1;
  91.  
  92.  
  93.  
  94.     ________________________________________________________________________
  95.                                                Chapter 11: Commands   101
  96.     ________________________________________________________________________
  97.  
  98.  
  99.     -----------------------------------
  100.     ANSWER
  101.  
  102.     Syntax:
  103.     answer question [with <button1> [,<button2> [,<button3>]]];
  104.  
  105.     Purpose: The answer command allows you to create dialog boxes that ask a
  106.     question. The user responds by choosing one of the buttons supplied. The
  107.     dialog box is similar to other HyperPAD dialog boxes and is always
  108.     centered on the page. You can specify up to 3 buttons to choose from.
  109.  
  110.     The Answer dialog box looks like this:
  111.  
  112.  ┌───────────────────────────────────────────────────────────────────────┐
  113.  │                                                                       │
  114.  │ **** The Printed Documentation has a picture or screen shot here **** │
  115.  │                                                                       │
  116.  └───────────────────────────────────────────────────────────────────────┘
  117.     
  118.  
  119.     The <question> is the text within the dialog box. The text can be many
  120.     lines long, in which case it is word-wrapped. Use carriage returns to
  121.     improve the readability of your messages.
  122.  
  123.     The user can choose one of up to three buttons you supply in <button1>,
  124.     <button2>, <button3>. If you don't specify any buttons to choose from,
  125.     HyperPAD uses the two default buttons: <<Ok>> and <Cancel>.
  126.  
  127.     When the user accesses the dialog box, it remains on-screen until a
  128.     choice is selected. After the user responds, either by selecting a
  129.     choice or pressing ESC, the dialog box is removed and the selected
  130.     button text is placed into the local variable it. For example, if the
  131.     user selects <<Ok>>, it will contain "Ok". If the user selects <Cancel>,
  132.     it will contain "cancel". If the user presses ESC, then the variable it
  133.     will be empty.
  134.  
  135.  
  136.  
  137.     ________________________________________________________________________
  138.                                                Chapter 11: Commands   102
  139.     ________________________________________________________________________
  140.  
  141.  
  142.     Examples:
  143.  
  144.     answer "Ok to quit?";
  145.  
  146.     answer "Continue printing?" with "Yes","No";
  147.  
  148.     answer "What color?" with "red","blue","green";
  149.  
  150.     answer "Error printing!" with "Ok";
  151.  
  152.     The following handler asks the user if it is Ok to quit:
  153.  
  154.     handler cancel;
  155.     begin
  156.       "Ok to quit?" with "Yes","No";
  157.       if it is "Yes" then quit;
  158.     end;
  159.  
  160.     See Also: ask
  161.  
  162.     -----------------------------------
  163.     ASK
  164.  
  165.     Syntax:
  166.     ask question [with <default response>];
  167.  
  168.     Purpose: The ask command allows you to gather information from the pad's
  169.     user by creating a dialog box in which the user types a response. The
  170.     Ask dialog box presents a question as a prompt, a text box in which to
  171.     type a response, and <<Ok>> and <Cancel> buttons.
  172.  
  173.  ┌───────────────────────────────────────────────────────────────────────┐
  174.  │                                                                       │
  175.  │ **** The Printed Documentation has a picture or screen shot here **** │
  176.  │                                                                       │
  177.  └───────────────────────────────────────────────────────────────────────┘
  178.     
  179.  
  180.     When the user presses the <<Ok>> button, the response is put in the
  181.     local variable it. If there is no response, or <Cancel> is selected, the
  182.     local variable it will be empty.
  183.  
  184.  
  185.  
  186.     ________________________________________________________________________
  187.                                                Chapter 11: Commands   103
  188.     ________________________________________________________________________
  189.  
  190.  
  191.     If you supply a default answer, it is presented in the text box as the
  192.     default response. Then, when the user begins typing in a different
  193.     response, the proposed answer is replaced by the typed one.
  194.  
  195.     Note: You cannot change the proposed buttons in the Ask dialog box. They
  196.     will always be Ok and Cancel.
  197.  
  198.     Examples:
  199.  
  200.     ask "What is your name?";
  201.  
  202.     The following uses ask to go to the page that the user specifies. If the
  203.     user cancels the dialog box, the process stops:
  204.  
  205.     handler select;
  206.     begin
  207.       while true do
  208.         begin
  209.           ask "Go to which page?" with currentPage + 1;
  210.           if it is empty then exit;
  211.           go to page it;
  212.         end;
  213.     end;
  214.  
  215.     See Also: answer
  216.  
  217.     -----------------------------------
  218.     CLOSE
  219.  
  220.     Syntax:
  221.     close <file number>;
  222.  
  223.     Purpose: The close command closes a previously opened file. All files
  224.     must be closed after you are finished with them. (You can open a file
  225.     using the create and open functions.)
  226.  
  227.     Examples:
  228.  
  229.     close fh;
  230.  
  231.     The following example writes the contents of field 1 to a file:
  232.  
  233.     put create("data.dat") into fh;
  234.     write field 1 to fh;
  235.     close fh;
  236.  
  237.     Note: This command sends the close message.
  238.  
  239.     See Also: create, open, read, write
  240.  
  241.  
  242.  
  243.     ________________________________________________________________________
  244.                                                Chapter 11: Commands   104
  245.     ________________________________________________________________________
  246.  
  247.  
  248.     -----------------------------------
  249.     CONVERT
  250.  
  251.     Syntax:
  252.     convert container to <format> [and <format>];
  253.     convert var1 to seconds;
  254.     convert var1 to dateItems;
  255.     convert var1 to [long | short | abbreviated] date;
  256.     convert var1 to [long | short] time;
  257.     convert var1 to [long | short | abbreviated] date and
  258.     [long | short] time;
  259.  
  260.     Purpose: This command converts dates to different formats. The range of
  261.     dates HyperPAD understands starts from Saturday, January 1, 1583 -- the
  262.     starting date of the Gregorian Calendar. Using convert, you can input a
  263.     numerical date, like "5/8/90", and translate it to written form, like
  264.     "Tuesday, May 8, 1990".
  265.  
  266.     The following are explanations of target formats using January 1, 1990
  267.     at 5:00:00 PM as an example.
  268.  
  269.     Date Format:                  Example:
  270.     -----------------------------------------------------------------
  271.     date (same as short date)     1-1-90 The dash (-) is the only date
  272.                                   separator output by convert
  273.  
  274.     long date                     Monday, January 1, 1990
  275.  
  276.     abbreviated date              Mon, Jan 1, 1990
  277.  
  278.     seconds                       12843766800 The number of seconds since
  279.                                   1-1-1583
  280.  
  281.     time                          5:00 PM
  282.  
  283.     long time                     5:00:00
  284.  
  285.     dateItems                     1990,1,1,17,0,0,2 (year, month, day, hour,
  286.                                   minute, second, day of week)
  287.  
  288.  
  289.  
  290.     ________________________________________________________________________
  291.                                                Chapter 11: Commands   105
  292.     ________________________________________________________________________
  293.  
  294.  
  295.     Container formats:  The power of convert is derived from the flexible
  296.     representation of the container being converted. The following are
  297.     allowed:
  298.  
  299.     1.  Both the dash and slash (-,/) can be used as date separators.
  300.  
  301.     2.  Date item lists can be modified creating an invalid date and then
  302.     normalized by converting it to another format. The following example
  303.     modifies the dateItems list to figure out the date 40 days from today:
  304.  
  305.     get the seconds;  --get today's date and time
  306.     convert it to dateItems;  --convert to date item list
  307.     add 40 to item 3 of it;   --add 40 days
  308.     convert it to longDate;   --normalize
  309.     answer "40 days from now is" && it;
  310.  
  311.     The next example modifies the dateItems list to figure out what the date
  312.     and time will be 18 hours from now:
  313.  
  314.     get the seconds;  --get today's date in seconds
  315.     convert it to dateItems;  --convert to date item list
  316.     add 18 to item 4 of it;  --add 18 hours
  317.     convert it to longDate and time;  --normalize
  318.     answer "18 hours from now is" && it;
  319.  
  320.     3.  The formats that you can convert from are loose. The following are
  321.     suitable formats for convert:
  322.  
  323.     Example:                   Format:
  324.     -----------------------------------------------------
  325.     Jan 1, 1990                date
  326.  
  327.     January 1, 1990            date
  328.  
  329.     Jan 1, 90                  date
  330.  
  331.     Jan 1, 1990 11:20          date and time
  332.  
  333.     Mon, Jan 1, 90 11:20 AM    date and time
  334.  
  335.     11:20                      time
  336.  
  337.     11:20 PM                   time
  338.  
  339.     11:20 Jan 1, 1990          time and date
  340.  
  341.     11:20 Mon, Jan 1, 1190     time and date
  342.  
  343.     65                         seconds
  344.  
  345.     1990,1,1,17,00,2           dateItems
  346.  
  347.  
  348.  
  349.     ________________________________________________________________________
  350.                                                Chapter 11: Commands   106
  351.     ________________________________________________________________________
  352.  
  353.  
  354.     Examples:
  355.  
  356.     This function returns the day of the week of the first day of the
  357.     current month:
  358.  
  359.     function firstDay;
  360.     begin
  361.       get the date;
  362.       convert it to dateItems; --represent as date items
  363.       put 1 into item 3 of it; -- put 1 as day of the month
  364.       convert it to long date; -- convert to string
  365.       return word 1 of it; -- return day of week
  366.     end;
  367.  
  368.     This handler computes tomorrows date:
  369.  
  370.     handler tomorrow;
  371.     begin
  372.       get the seconds;
  373.       add 60 * 60 * 24 to it;
  374.       convert it to long date;
  375.       answer "Tomorrows date is" && it;
  376.     end;
  377.  
  378.     Comments: The following months and days of the week and their
  379.     abbreviations are recognized by HyperPAD:
  380.  
  381.     Keyword:               Abbreviation:
  382.     ------------------------------------------
  383.     january                jan
  384.  
  385.     february               feb
  386.  
  387.     march                  mar
  388.  
  389.     april                  apr
  390.  
  391.     may                    may
  392.  
  393.     june                   jun
  394.  
  395.     july                   jul
  396.  
  397.     august                 aug
  398.  
  399.     september              sep
  400.  
  401.     october                oct
  402.  
  403.     november               nov
  404.  
  405.     december               dec
  406.  
  407.  
  408.  
  409.     ________________________________________________________________________
  410.                                                Chapter 11: Commands   107
  411.     ________________________________________________________________________
  412.  
  413.  
  414.     Keyword:               Abbreviation:
  415.     ------------------------------------------
  416.     sunday                 sun
  417.  
  418.     monday                 mon
  419.  
  420.     tuesday                tue
  421.  
  422.     wednesday              wed
  423.  
  424.     thursday               thu
  425.  
  426.     friday                 fri
  427.  
  428.     saturday              sat
  429.  
  430.     See Also: time, longTime(), seconds(), date(), longDate()
  431.  
  432.     -----------------------------------
  433.     DELETE
  434.  
  435.     Syntax:
  436.     delete <chunk> from <container>;
  437.     delete <container;>
  438.  
  439.     Purpose: The delete command can be used to remove a chunk of
  440.     information, or all the information from a container. The number of
  441.     characters removed from the container is specified by using a chunking
  442.     expression involving items, words, lines or characters (see the section
  443.     on Chunking).
  444.  
  445.     If you do not specify a chunk to be deleted, HyperPAD will delete all of
  446.     the characters in the container. For example:
  447.  
  448.     delete page field 1;
  449.  
  450.     delete salesTax;
  451.  
  452.     Chunks are defined by the characters that are around them. When you
  453.     delete items and lines from a container, you also remove the delimiter
  454.     (either a comma or carriage return) that defines it. For example,
  455.     deleting a line from a field would delete the carriage return at the end
  456.     of the line (if there is one).
  457.  
  458.     The following example deletes items from a field. Suppose field 1
  459.     contains "Jim, John, Sally, Lisa". The following statement:
  460.  
  461.     delete item 2 to 3 of field 1;
  462.  
  463.     results in field 1 containing "Jim, Lisa". Note that "John, Sally," was
  464.     deleted, including the commas.
  465.  
  466.  
  467.  
  468.     ________________________________________________________________________
  469.                                                Chapter 11: Commands   108
  470.     ________________________________________________________________________
  471.  
  472.  
  473.     When to use it:  When you want to remove a specific part of a
  474.     container's value while keeping the rest intact.
  475.  
  476.     Examples:
  477.  
  478.     delete myvar;
  479.     delete page field 5;  -- removes all chars in page field 5
  480.  
  481.     The following example deletes the current line from page field 1:
  482.  
  483.     get the currentLine of page field 1;
  484.     delete line it from page field 1;
  485.  
  486.     The next example deletes all of the lines that contain the word "BAD".
  487.     Care is taken to make sure that the loop is performed the correct number
  488.     of times because the number of lines change as we delete lines:
  489.  
  490.     put the number of lines of page field 1 into numlines;
  491.     put 1 into i;
  492.     while i  numlines do
  493.       begin
  494.         if line i of page field 1 contains "BAD" then
  495.           begin
  496.             delete line i of page field 1;
  497.             subtract 1 from numlines;
  498.           end
  499.         else add 1 to i;
  500.       end;
  501.  
  502.     -----------------------------------
  503.     DIAL
  504.  
  505.     Syntax:
  506.     dial [pulse | tone | noHayes] <number> [with <modem commands>];
  507.  
  508.     Purpose: With dial, you can call any telephone number (using  a modem)
  509.     for voice communication. Specify pulse or tone dialing, depending on
  510.     your phone service (the default is pulse).
  511.  
  512.     While dialing, you are presented with a message, indicating that dialing
  513.     is in progress
  514.  
  515.     If the dial is successful, a dialog box will be displayed requesting
  516.     that you pick up the phone. The modem will remain connected until this
  517.     dialog box is removed (by selecting the <<Ok>> button).
  518.  
  519.     The dial command performs the following steps when dialing the phone:
  520.  
  521.     1.  The modem port is initialized using the current settings of the
  522.     global properties modem, dataBits, stopBits, parity, and baud.
  523.  
  524.  
  525.  
  526.     ________________________________________________________________________
  527.                                                Chapter 11: Commands   109
  528.     ________________________________________________________________________
  529.  
  530.  
  531.     2.  The modem is initialized using the Hayes modem command "ATV1E0",
  532.     causing the modem to echo responses to HyperPAD. HyperPAD waits for the
  533.     modem to respond "Ok".
  534.  
  535.     3.  The <expression> is prefixed with "ATDP" or "ATDT" depending on if
  536.     you specified tone or pulse. Specifying <modem commands> replaces this
  537.     default prefix with your own.
  538.  
  539.     For example, the following dial commands are the same:
  540.  
  541.     dial "5551212" with "ATDT";
  542.     dial tone "5551212";
  543.  
  544.     4.  The <expression> is ended with a semi-colon and a carriage return.
  545.  
  546.     5.  The Progress box is displayed and the new expression is sent to the
  547.     modem.
  548.  
  549.     6.  When the number has completed dialing, a dialog box is displayed
  550.     indicating that it is Ok to pick up the phone.
  551.  
  552.     7.  After you select the <<Ok>> button from this dialog box, the text
  553.     "ATH0" is sent to the modem and HyperPAD waits for the modem to respond
  554.     "Ok".
  555.  
  556.     If dial is unsuccessful, you will receive an error message .
  557.  
  558.     This error is not a normal runtime error, however, and will not stop
  559.     execution of your script. You can determine if an error occurred by
  560.     using the result() function. The result() will be the text "not dialed"
  561.     if there was an error, or empty if the dial was successful.
  562.  
  563.     If you have a Hayes incompatible modem, you can use the noHayes option
  564.     to dial the phone. In this case, HyperPAD will not send any modem
  565.     commands to your modem. The dial command performs the following steps:
  566.  
  567.     1.  The modem port is initialized using the current settings of the
  568.     global properties modem, dataBits, stopBits, parity, and baud.
  569.  
  570.     2.  If you specified <modem commands>, HyperPAD will prefix it to
  571.     <expression>.
  572.  
  573.     3.  HyperPAD sends the new expression to the serial port. HyperPAD will
  574.     not wait for a response; it will return immediately.
  575.  
  576.     For example:
  577.  
  578.     dial nohayes "5551212";
  579.     dial nohayes "D 5551212;" & return;
  580.  
  581.     The nohayes option is also useful to initialize your serial port.
  582.  
  583.  
  584.  
  585.     ________________________________________________________________________
  586.                                                Chapter 11: Commands   110
  587.     ________________________________________________________________________
  588.  
  589.  
  590.     The following example uses dial to initialize the COM1 port to
  591.     1200,N,8,1:
  592.  
  593.     set the modem to "com1";
  594.     set the baud to 1200;
  595.     set the parity to "none";
  596.     set the stopBits to 8;
  597.     set the dataBits to 1;
  598.     dial nohayes empty;
  599.  
  600.     Examples:
  601.  
  602.     dial "315-463-1234";
  603.  
  604.     dial "315-463-1234" with "ATZ";
  605.  
  606.     dial pulse "9,18002341624";
  607.     if result() is "not dialed" then
  608.       answer "Can't dial the phone";
  609.  
  610.     The following example prompts for a number, then dials it. Special care
  611.     is taken to check for an area code enclosed in parenthesis. This means
  612.     that the number is long distance and should be preceded by a 1.
  613.  
  614.     ask "Number to dial:";
  615.     if char 1 of it is "(" then
  616.       begin
  617.         -- get rid of parenthesis
  618.         get substitute(it,"(","");
  619.         get substitute(it,")","");
  620.         -- long distance
  621.         put 1 before it;
  622.       end;
  623.     get substitute(it," ","");
  624.     dial it;
  625.     if the result is not empty then
  626.       answer "Error dialing the phone!";
  627.  
  628.     Note: The serial port is not initialized until you issue the dial
  629.     command.
  630.  
  631.     See Also: baud, parity, stopBits, dataBits, modem
  632.  
  633.  
  634.  
  635.     ________________________________________________________________________
  636.                                                Chapter 11: Commands   111
  637.     ________________________________________________________________________
  638.  
  639.  
  640.     -----------------------------------
  641.     DIVIDE
  642.  
  643.     Syntax:
  644.     divide <destination> by <expression>
  645.  
  646.     Purpose: The divide command divides <destination> by <expression> and
  647.     places the result back into <destination>. The <expression> must be a
  648.     number or a container holding a number. The <destination> must be a
  649.     container.
  650.  
  651.     Note:  You will receive a runtime error if either the <destination> or
  652.     the <expression> is not a number.
  653.  
  654.     Examples:
  655.  
  656.     divide page field 23 by 4;
  657.  
  658.     divide salesTax by 0.07;
  659.  
  660.     -----------------------------------
  661.     DO
  662.  
  663.     Syntax:
  664.     do <expression>
  665.  
  666.     Purpose: The do command compiles and executes the <expression>. This
  667.     command provides a mechanism for executing statements from within a
  668.     handler that haven't been compiled.
  669.  
  670.     The do command executes statements the same way as the message box.
  671.     Thus, you can use the do command to evaluate expressions, putting the
  672.     result into the message box. The following example puts the result of a
  673.     calculation into the message box:
  674.  
  675.     do "3 + 4 - " && page field 1;
  676.  
  677.     You can only execute one command at a time. Thus, the <expression> can
  678.     contain many statements.
  679.  
  680.     The do command must compile the specified statement, which may cause a
  681.     slight delay in your script execution. The compiler must be located in
  682.     the disk file "HPAD2.OVL", which must be accessible for this command to
  683.     work.
  684.  
  685.  
  686.  
  687.     ________________________________________________________________________
  688.                                                Chapter 11: Commands   112
  689.     ________________________________________________________________________
  690.  
  691.  
  692.     Examples:
  693.  
  694.     do "go to the next page";
  695.  
  696.     answer "Go where" with "next","previous";
  697.     do "go to" && it && "page";
  698.  
  699.     The following statements execute the contents of field 1:
  700.  
  701.     do page field 1;
  702.  
  703.     -----------------------------------
  704.     EDIT SCRIPT
  705.  
  706.     Syntax:
  707.     edit [the] script of <object>;
  708.  
  709.     Purpose: This command is used to edit the script of different objects.
  710.     This is the same as selecting the object's Info dialog box and selecting
  711.     the  <Script...>  button.
  712.  
  713.     Examples:
  714.  
  715.     edit the script of page "Preferences";
  716.  
  717.     edit the script of page button 3;
  718.  
  719.     edit the script of background "Template";
  720.  
  721.     edit the script of pad;
  722.  
  723.     -----------------------------------
  724.     FIND
  725.  
  726.     Syntax:
  727.     find [part | whole] <expression> [in <field>];
  728.  
  729.     Purpose: The find command locates text anywhere in your pad. If you
  730.     restrict the search to a single background field, only text on any page
  731.     in that field will be locate. If you don't restrict the search to a
  732.     particular background field, find will locate text in any field in your
  733.     pad. (The find command will not locate text on the painting layer of the
  734.     page or background.)
  735.  
  736.     HyperPAD searches differently for a part than it does for a whole. The
  737.     whole option tells HyperPAD to locate only whole words; that is, only
  738.     occurrences that are enclosed by word delimiters (such as spaces, end of
  739.  
  740.  
  741.  
  742.     ________________________________________________________________________
  743.                                                Chapter 11: Commands   113
  744.     ________________________________________________________________________
  745.  
  746.  
  747.     lines, and punctuation) will be found. The part option tells HyperPAD to
  748.     locate the text anywhere, even if it occurs within another word.
  749.  
  750.     For example, consider a field containing "John is a lawyer". The
  751.     following statement will not find a match:
  752.  
  753.     find whole "law";
  754.  
  755.     The next statement, however, will find a match:
  756.  
  757.     find whole "is";
  758.  
  759.     Using find part, HyperPAD  will find occurrences anywhere within the
  760.     target text, even if the expression occurs within a word. For example,
  761.     consider the same text "John is a lawyer". The following statement will
  762.     find a match:
  763.  
  764.     find part "law";
  765.  
  766.     Up to 10 strings can be specified. If more than one is given, find will
  767.     locate any of the expressions in the destination. For example:
  768.  
  769.     find whole "john","joe","jack"
  770.  
  771.     After finding an occurrence, the user can press ENTER to search for the
  772.     next instance of the string. If the user presses ENTER, the search
  773.     begins on the current page where the previous find left off.
  774.  
  775.     If the user presses any other key, the search is terminated.
  776.  
  777.     If find locates a match within a locked field, you are taken to the page
  778.     containing the match and the focus is set to the default object (because
  779.     a locked field cannot receive the focus). If the user presses ENTER to
  780.     locate the next match, the search begins on the next field after the
  781.     locked one.
  782.  
  783.     If you use find from the message box, the Find in Progress box is
  784.     displayed while HyperPAD searches; two beeps will sound if no matches
  785.     are found. If you execute find from a script, the Find in Progress box
  786.     and beeps won't occur.
  787.  
  788.     Determine the result of the find command using the result() function. If
  789.     the find is successful, result will return "found". Otherwise, result
  790.     will return "not found".
  791.  
  792.     Examples:
  793.  
  794.     To find John anywhere in the pad:
  795.  
  796.     find "John";
  797.  
  798.  
  799.  
  800.     ________________________________________________________________________
  801.                                                Chapter 11: Commands   114
  802.     ________________________________________________________________________
  803.  
  804.  
  805.     To find John in the "first name" field:
  806.  
  807.     find "John" in field "First Name";
  808.  
  809.     The following button handler locates the next occurrence of the
  810.     highlighted text. If the user hasn't highlighted any text, the Ask
  811.     dialog box will appear and ask for something to find:
  812.  
  813.     handler select;
  814.     begin
  815.       get the selectedText;
  816.       if it is empty then ask "Find What?";
  817.       if it is empty then exit;
  818.       find it;
  819.       if the result is "not found" then
  820.         answer "Can't find" && it with "Ok";
  821.     end;
  822.  
  823.     -----------------------------------
  824.     FLUSHCACHE
  825.  
  826.     Syntax:
  827.     flushCache;
  828.  
  829.     Purpose: This command writes to disk all of the pages in memory that
  830.     have been changed and empties the cache. Internally, HyperPAD keeps
  831.     recently accessed pages in an area of the memory called the cache. When
  832.     the cache becomes too large to fit in the memory, a page that hasn't
  833.     been used in a long time is removed from the cache and written to disk.
  834.  
  835.     When to use it: Anytime you need more free memory for a particular
  836.     operation, use this command. Also, use flushCache to prevent thrashing.
  837.     (Thrashing is the constant disk access that occurs when the cache is
  838.     full. For each new page read from the disk, a page must be written out.)
  839.  
  840.     Examples:
  841.  
  842.     flushCache;
  843.  
  844.     The following example frees up the maximum amount of memory before
  845.     cycling through all of the pages in a pad:
  846.  
  847.     flushCache;
  848.     for i = 1 to the number of pages do
  849.       go to page i;
  850.  
  851.     Note: This command sends the flushCache message. The cache is flushed
  852.     when the message is received by HyperPAD.
  853.  
  854.     See Also: maxDirtyPages, autoSave
  855.  
  856.  
  857.  
  858.     ________________________________________________________________________
  859.                                                Chapter 11: Commands   115
  860.     ________________________________________________________________________
  861.  
  862.  
  863.     -----------------------------------
  864.     FXSHOW
  865.  
  866.     Syntax:
  867.     fxshow <fileName>;
  868.  
  869.     Purpose: This command is used to display images or screen shows from
  870.     within HyperPAD. The fxshow command requires an external file called
  871.     FXSHOW.EXE. The <fileName> parameter is the DOS filename of the .PRO,
  872.     .PR2, .SLD, or .GX2 file you want to view.
  873.  
  874.     When HyperPAD loads for the first time, HyperPAD looks for the file
  875.     FXSHOW.EXE in the same directory as HPAD.EXE. If the file is found, you
  876.     will see an additional credit message displayed at the bottom of the
  877.     screen informing you that fxshow is available. You cannot use the fxshow
  878.     command if FXSHOW.EXE is not located in this directory.
  879.  
  880.     The fxshow command causes HyperPAD to shrink down to 3K and run the
  881.     program FXSHOW.EXE, passing it information about what files to load.
  882.     Refer to Appendix 4, "Support for Show Partner F/X" for more
  883.     information.
  884.  
  885.     When running the show, HyperPAD does the following:
  886.  
  887.     1.  Switches to the directory containing <fileName>.
  888.  
  889.     2.  If no extension is specified, searches for files in this order:
  890.     *.PRO, *.PR2, *.SLD, *.GX2.
  891.  
  892.     3.  Issues the suspend message to run FXSHOW.EXE.
  893.  
  894.     4.  Runs the show.
  895.  
  896.     5.  Returns control to HyperPAD.
  897.  
  898.     This is very similar to running a program with the run command, except
  899.     that HyperPAD first changes to the directory containing the files you
  900.     run.
  901.  
  902.     Examples:
  903.  
  904.     fxshow "sample";
  905.  
  906.     fxshow "C:\FX\SAMPLE\SAMPLE";
  907.  
  908.     fxshow "d:\pics\*.gx2";
  909.  
  910.     Note: This command sends the fxshow message. The handler for this
  911.     message is implemented in HyperPAD.
  912.  
  913.  
  914.  
  915.     ________________________________________________________________________
  916.                                                Chapter 11: Commands   116
  917.     ________________________________________________________________________
  918.  
  919.  
  920.     -----------------------------------
  921.     GET
  922.  
  923.     Syntax:
  924.     get <expression>;
  925.  
  926.     Purpose: Use get to retrieve a value and put it into the local variable
  927.     it. The <expression> can be a constant, a literal, a function, or a
  928.     container (the value of a variable, a field's contents, or the contents
  929.     of the message box).
  930.  
  931.     Examples:
  932.  
  933.     get 1 + 2 * 3;
  934.  
  935.     get field 1 of page 25;
  936.  
  937.     get word 1 to 5 of line 6 of field id 2 of page 88;
  938.  
  939.     Using the local variable it will enhance script readability and
  940.     execution speed, as shown in the following example:
  941.  
  942.     get the selectedText;
  943.     if it is empty then ask "What do you want to find?";
  944.     if it is empty then exit;
  945.     find it;
  946.  
  947.     See Also: put
  948.  
  949.     -----------------------------------
  950.     GLOBAL
  951.  
  952.     Syntax:
  953.     global <var1> [<var2>,...];
  954.  
  955.     Purpose: The global statement allows you to declare a global variable. A
  956.     Global variable is accessible to all handlers, not just the handler in
  957.     which it is defined. Global variables remain until you exit HyperPAD or
  958.     run another program.
  959.  
  960.     Note:  The global command cannot be used in a do command or in the
  961.     message box.
  962.  
  963.     When to use it:  If you want a particular variable to maintain its value
  964.     between handlers or pads, you must define it as a global variable.
  965.  
  966.     Examples:
  967.  
  968.     global taxAmount,salesAmount,userName;
  969.  
  970.  
  971.  
  972.     ________________________________________________________________________
  973.                                                Chapter 11: Commands   117
  974.     ________________________________________________________________________
  975.  
  976.  
  977.     -----------------------------------
  978.     GO
  979.  
  980.     Syntax:
  981.  
  982.     go [to] [pad] <padName> [with diskChange <expression>];
  983.     go [to] <background> [of [pad] <padName> [with diskChange
  984.     <expression>]];
  985.     go [to] <page> [of <background>] [of [pad] <padName> [with diskChange
  986.     <expression>]];
  987.     go back;
  988.     go help;
  989.     go home;
  990.  
  991.     Purpose: The go command changes to another page, background or pad. The
  992.     destination indicates which page (and if necessary, which pad) will be
  993.     displayed. If the destination specifies only a pad, HyperPAD goes to the
  994.     default page (the page which was last accessed) of that pad. You can
  995.     alter the destination by supplying a container as the destination.
  996.  
  997.     The diskChange option allows you to specify that the destination pad may
  998.     be on a different disk. In this case, the user will be asked to switch
  999.     disks using the <expression> that you supply as a prompt. For example:
  1000.  
  1001.     go to pad "a:phone" with diskChange "Insert Disk 2";
  1002.  
  1003.     When you supply the diskChange parameter:
  1004.  
  1005.     1.  The current pad is closed.
  1006.  
  1007.     2.  HyperPAD displays a dialog box with the message the you supplied.
  1008.  
  1009.     3.  The user can then remove a disk and insert the disk containing the
  1010.     desired pad. If the user selects <<Ok>>, HyperPAD will attempt to load
  1011.     the pad from the new disk.
  1012.  
  1013.     If the user is unable to insert the correct disk and presses <Cancel> at
  1014.     the dialog box, HyperPAD will attempt to load the original pad. If
  1015.     unable to do so, HyperPAD will ask the user to insert the original
  1016.     disk...and will continue to do so until the original disk has been
  1017.     inserted.
  1018.  
  1019.     The go home and go help statements are special because they use
  1020.     HyperPAD's special file searching method to locate the pad.
  1021.  
  1022.  
  1023.  
  1024.     ________________________________________________________________________
  1025.                                                Chapter 11: Commands   118
  1026.     ________________________________________________________________________
  1027.  
  1028.  
  1029.     The statement
  1030.  
  1031.     go to pad "HOME";
  1032.  
  1033.     may not be unable to locate the Home pad because it may not be in the
  1034.     current directory or path. Thus, if you want to access either the Home
  1035.     or Help pads you should use go home and go help.
  1036.  
  1037.     go back - is the same as selecting Back from the Go menu.
  1038.  
  1039.     go recent - goes to the most recently accessed page (the one that you
  1040.     just came from).
  1041.  
  1042.     You can also use ordinal types with the go command. The allowed ordinal
  1043.     types are:
  1044.  
  1045.     first, second, third,...,tenth
  1046.     next
  1047.     previous
  1048.     any
  1049.     middle
  1050.     this
  1051.     recent
  1052.  
  1053.     If you attempt to go to a page beyond the end of the pad, the result()
  1054.     function will return "no such page"; otherwise, it will return empty.
  1055.  
  1056.     Examples:
  1057.  
  1058.     go to page 1;
  1059.  
  1060.     go to page 1 of background 2;
  1061.  
  1062.     go to background "template";
  1063.  
  1064.     go "phone";
  1065.  
  1066.     go to pad "phone";
  1067.  
  1068.     go to pad "phone" with diskChange "Insert Disk 2";
  1069.  
  1070.     go to page 2 of pad "Phone";
  1071.  
  1072.     go to page 1 of background 2 of pad "Phone" with
  1073.        diskChange "Insert Disk 2";
  1074.  
  1075.     go to the next page;
  1076.  
  1077.     go to page (currentPage() + 10);
  1078.  
  1079.     go to page ("taxNumber" && i);
  1080.  
  1081.  
  1082.  
  1083.     ________________________________________________________________________
  1084.                                                Chapter 11: Commands   119
  1085.     ________________________________________________________________________
  1086.  
  1087.  
  1088.     go to any page;
  1089.  
  1090.     go to the recent page;
  1091.  
  1092.     go to the first page of pad "Phone"
  1093.  
  1094.     ask "Go to what pad?";  -- ask for a name
  1095.     go to pad it;
  1096.  
  1097.     ask "Go to what page?";  -- ask for name or number
  1098.     go to page it;
  1099.  
  1100.     Note: Remember, pads are only referenced by name. Thus, the only way to
  1101.     go to a pad is to supply the DOS name of the pad:
  1102.  
  1103.     go to pad "phone";
  1104.  
  1105.     Pages and backgrounds, however, can be referenced by either their number
  1106.     within the pad, their ID, or their name. For example:
  1107.  
  1108.     go to page 10;       -- by page number
  1109.  
  1110.     go to page id 56;    -- by page ID
  1111.  
  1112.     go to page "status"; -- by page name
  1113.  
  1114.     When going to backgrounds, HyperPAD really goes to pages on the
  1115.     specified background. The following list summarizes what happens with
  1116.     different go statements involving backgrounds:
  1117.  
  1118.     The following statement goes to the first page on the first background
  1119.     that you created.
  1120.  
  1121.     go to background 1;
  1122.  
  1123.     The next statement goes to the first page after the current page that is
  1124.     on a different background.
  1125.  
  1126.     go to the next background;
  1127.  
  1128.     The next statement goes to the fifth page that uses background 2.
  1129.  
  1130.     go to page 5 of background 2;
  1131.  
  1132.     The next statement goes to the next page after the current page that
  1133.     uses the same background.
  1134.  
  1135.     go to the next page of this background;
  1136.  
  1137.  
  1138.  
  1139.     ________________________________________________________________________
  1140.                                                Chapter 11: Commands   120
  1141.     ________________________________________________________________________
  1142.  
  1143.  
  1144.     -----------------------------------
  1145.     HIDE
  1146.  
  1147.     Syntax:
  1148.     hide <object>;
  1149.  
  1150.     Purpose: The hide command allows you to make the specified button or
  1151.     field invisible. This command actually modifies the visible property of
  1152.     the target object. In fact, the following two statements are equivalent:
  1153.  
  1154.     hide page button 1;
  1155.  
  1156.     set the visible of page button 1 to false;
  1157.  
  1158.     When to use it:  If you want a button or field to become visible only
  1159.     when certain criteria are met, you can use hide and show to toggle the
  1160.     object's visibility.
  1161.  
  1162.     Examples:
  1163.  
  1164.     hide page field 1;
  1165.  
  1166.     hide background button 3;
  1167.  
  1168.     See Also: show, visible
  1169.  
  1170.     -----------------------------------
  1171.     HILITE
  1172.  
  1173.     Syntax:
  1174.     hilite [<chunk>];
  1175.     hilite <field>;
  1176.     hilite the message box;
  1177.  
  1178.     Purpose: This command highlights text within a field or the message box.
  1179.     The text that gets highlighted is copied into the selectedText.
  1180.  
  1181.     When highlighting text, the text becomes highlighted on the screen.
  1182.  
  1183.  
  1184.  
  1185.     ________________________________________________________________________
  1186.                                                Chapter 11: Commands   121
  1187.     ________________________________________________________________________
  1188.  
  1189.  
  1190.     Examples:
  1191.  
  1192.     hilite char 1 to 5 of page field 1;
  1193.  
  1194.     hilite line 1 of page field 1;
  1195.  
  1196.     hilite the last line of me;
  1197.  
  1198.     hilite field "Last Name";
  1199.  
  1200.     hilite the message box;
  1201.  
  1202.     hilite word 2 of msg;
  1203.  
  1204.     The following example locates the word "lawyer" in a field and
  1205.     highlights it.
  1206.  
  1207.     get offset("lawyer",field "occupation");
  1208.     if it is 0 then exit;
  1209.     hilite char it to (it + 5) of field "occupation";
  1210.  
  1211.     See Also: selectedText
  1212.  
  1213.     -----------------------------------
  1214.     MULTIPLY
  1215.  
  1216.     Syntax:
  1217.     multiply <destination> by <expression>;
  1218.  
  1219.     Purpose: This command multiplies the value of the <destination> by the
  1220.     value of the <expression> and places the result into the <destination>.
  1221.     The expression must be a number or a container holding a number. The
  1222.     destination must be a container.
  1223.  
  1224.     Note:  You will receive a runtime error if the <destination> or the
  1225.     <expression> are not
  1226.     both numbers.
  1227.  
  1228.     Examples:
  1229.  
  1230.     multiply page field 1 by 6;
  1231.  
  1232.     multiply totalAmount by salesTax;
  1233.  
  1234.     multiply the message box by 10;
  1235.  
  1236.     See Also: add, subtract, divide
  1237.  
  1238.  
  1239.  
  1240.     ________________________________________________________________________
  1241.                                                Chapter 11: Commands   122
  1242.     ________________________________________________________________________
  1243.  
  1244.  
  1245.     -----------------------------------
  1246.     NOSOUND
  1247.  
  1248.     Syntax:
  1249.     noSound;
  1250.  
  1251.     Purpose: This command stops any music or tones that are currently being
  1252.     played.
  1253.  
  1254.     Examples:
  1255.  
  1256.     sound 2000;    -- start a sound
  1257.     wait 200;      -- 200 milliseconds
  1258.     noSound;       -- turn it off
  1259.  
  1260.     The following example plays notes for 5 seconds.
  1261.  
  1262.     play "abcdefg";
  1263.     wait 5000;
  1264.     noSound;
  1265.  
  1266.     Note: This command sends the noSound message which is implemented in
  1267.     HyperPAD.
  1268.  
  1269.     -----------------------------------
  1270.     PLAY
  1271.  
  1272.     Syntax:
  1273.     play <expression>;
  1274.  
  1275.     Purpose: The play command allows you to play music in the background
  1276.     while other HyperPAD tasks are taking place.
  1277.  
  1278.  
  1279.  
  1280.     ________________________________________________________________________
  1281.                                                Chapter 11: Commands   123
  1282.     ________________________________________________________________________
  1283.  
  1284.  
  1285.     The <expression> is a string containing note and music commands:
  1286.  
  1287.     Command:   Description:
  1288.     -----------------------------------------------------------------
  1289.     A-G        Play this note.
  1290.  
  1291.     +,#        Make the preceding note sharp.
  1292.  
  1293.     -          Make the preceding note flat.
  1294.  
  1295.     Ln         Set the length of each note to n. L1= full note, L2 = 1/2
  1296.                note, L3= 1/4 note (default). The range of n is 1 to 64.
  1297.  
  1298.     MN         Play normal. Each not will play 7/8 of the time given by L.
  1299.  
  1300.     ML         Music legato. Each note will play the full time given by L.
  1301.  
  1302.     MS         Music staccato. Each note will play 3/4 of the time given by
  1303.                L.
  1304.  
  1305.     On         Sets the current octave to n. The default is 2, the range of
  1306.                octaves is 0 to 6. Middle C is at the beginning of octave 3.
  1307.  
  1308.     Pn         Pause = n. The range of n is 1 to 64.
  1309.  
  1310.     Tn         Tempo = n. This sets the number of L4 quarter notes in one
  1311.                minute. The range of n is 32-255. The default is 120.
  1312.  
  1313.     >n         Increases the octave of the next note by 1.
  1314.  
  1315.     <n         Decreases the octave of the next note by 1.
  1316.  
  1317.     .          Increases the playing time of the note (L*T) by 50%. Multiple
  1318.                periods can appear after a note (multiples the playing time
  1319.                by 3/2). Periods may also appear after a pause.
  1320.  
  1321.     Note:  Any spaces in your play string are ignored.
  1322.  
  1323.     Music continues to play in the background until there are no more notes
  1324.     to play. You can stop the music by issuing a noSound command. You can
  1325.     determine if music is playing using the isSound() function.
  1326.  
  1327.     Examples:
  1328.  
  1329.     play "cdefgabc";
  1330.  
  1331.     play "O1 L16 T12O A O2 P4.. B.";
  1332.  
  1333.     Notes: This command sends the play message. When the message is received
  1334.     by HyperPAD, the music will begin playing in the background.
  1335.  
  1336.     See Also: noSound, isSound()
  1337.  
  1338.  
  1339.  
  1340.     ________________________________________________________________________
  1341.                                                Chapter 11: Commands   124
  1342.     ________________________________________________________________________
  1343.  
  1344.  
  1345.     -----------------------------------
  1346.     PLAYBACK
  1347.  
  1348.     Syntax:
  1349.     playBack;
  1350.  
  1351.     Purpose: The playBack command starts the replay of keys that have
  1352.     previously been recorded using the record command.
  1353.     HyperPAD begins executing a playBack command on the next idle message.
  1354.  
  1355.     If keys are played back within HyperPAD, the first key will be pressed
  1356.     at the beginning at the next idle (when HyperPAD checks for key
  1357.     presses). The real power, however, is in HyperPAD's ability to play back
  1358.     keys while other programs are running, like in the following example:
  1359.  
  1360.     record "/frHOUSE.WK1{enter}";
  1361.     playback;
  1362.     run "C:\LOTUS\123.EXE" with programDirectory;
  1363.  
  1364.     Note: This command sends the playBack message. The playBack command is
  1365.     executed when this message is received by HyperPAD.
  1366.  
  1367.     See Also: record
  1368.  
  1369.     -----------------------------------
  1370.     POP PAGE
  1371.  
  1372.     Syntax:
  1373.     pop page [into <container>];
  1374.  
  1375.     Purpose: The pop page command removes the last pushed page from the page
  1376.     stack and either goes to it or places it into a container.
  1377.  
  1378.     The push page command allows you to remember where you are in your pad
  1379.     as if you had placed a bookmark on that page.
  1380.     Then, when you want to return there, you use the pop page command. You
  1381.     can place a series of these bookmarks, in which case pop page will take
  1382.     you to those pages in the reverse order in which you placed them.
  1383.  
  1384.  
  1385.  
  1386.     ________________________________________________________________________
  1387.                                                Chapter 11: Commands   125
  1388.     ________________________________________________________________________
  1389.  
  1390.  
  1391.     If you use the form
  1392.  
  1393.     pop page;
  1394.  
  1395.     you will actually be taken there (you will change pages and possibly the
  1396.     pad). You can also put the references to that page into a variable:
  1397.  
  1398.     pop page into pageRef;
  1399.  
  1400.     pageRef will contain a page reference similar to the following:
  1401.  
  1402.     page id 2 of pad "C:\HOME.PAD";
  1403.  
  1404.     Examples:
  1405.  
  1406.     The following statements show several different uses of the page stack.
  1407.     The first example remembers the current page, fetches the user's name
  1408.     from the Home pad, and returns.
  1409.  
  1410.     push this page;
  1411.     go home;
  1412.     go to page "preferences";
  1413.     put page field "User Name" into userName;
  1414.     pop page;
  1415.  
  1416.     push recent;
  1417.     pop page into pageRef;
  1418.     get the last word of pageRef;
  1419.     go to the first page of pad it;
  1420.  
  1421.     See Also: push page
  1422.  
  1423.     -----------------------------------
  1424.     PRINT
  1425.  
  1426.     Syntax:
  1427.     print <expression> [at <x>,<y>];
  1428.     print <page reference>;
  1429.     print <number> pages;
  1430.  
  1431.     Purpose: The print command prints either a page, a group of pages, or an
  1432.     expression at an optional X,Y location.
  1433.  
  1434.     Printing pages within HyperPAD is controlled by the current settings in
  1435.     the Print Page dialog box, the Page Setup dialog box, and the Printer
  1436.     Setup dialog box. Printing pages with the print command is exactly the
  1437.     same as choosing Print from the File menu and selecting the Pages
  1438.     option.
  1439.  
  1440.  
  1441.  
  1442.     ________________________________________________________________________
  1443.                                                Chapter 11: Commands   126
  1444.     ________________________________________________________________________
  1445.  
  1446.  
  1447.     For example:
  1448.  
  1449.     print page 1;
  1450.  
  1451.     print page "status";
  1452.  
  1453.     print the next page;
  1454.  
  1455.     print 10 pages;
  1456.  
  1457.     Printing text, on the other hand, is not controlled by the current print
  1458.     settings. You must turn the printer on and off manually (using the
  1459.     printer property) and eject pages by sending formfeeds from your script.
  1460.     The following steps are taken:
  1461.  
  1462.     1.  Turn the printer on.
  1463.  
  1464.     2.  Do your printing.
  1465.  
  1466.     3.  Turn the printer off.
  1467.  
  1468.     The print command keeps track of the printhead position internally. When
  1469.     you first turn the printer on, the print head is positioned at 1,1 on
  1470.     the page. As you print characters across the page, the print head X
  1471.     position changes to different coordinates, such as 10,1. As you print
  1472.     carriage returns, the X position is reset to 1 and the Y position is
  1473.     incremented, like 1,10. When you print an end of page (formfeed) the
  1474.     print head position is reset to 1,1.
  1475.  
  1476.     You can directly locate the print head using the print at syntax. For
  1477.     example:
  1478.  
  1479.     print "hello world" at 10,10;
  1480.  
  1481.     When using this syntax, you can only move the print head to the right on
  1482.     the current line or down on the page. The printhead cannot backtrack
  1483.     over already printed text.
  1484.  
  1485.     Examples:
  1486.  
  1487.     print page field 1;
  1488.  
  1489.     print page field 1 & return & page field 2;
  1490.  
  1491.     print formfeed;
  1492.  
  1493.     print page field "First Name" at 10,10;
  1494.  
  1495.  
  1496.  
  1497.     ________________________________________________________________________
  1498.                                                Chapter 11: Commands   127
  1499.     ________________________________________________________________________
  1500.  
  1501.  
  1502.     The following example prints the AUTOEXEC.BAT file:
  1503.  
  1504.     set the printer to on;
  1505.     put open ("C:\AUTOEXEC.BAT") into fh;
  1506.     if the result is not empty then exit;
  1507.     while the result is not "eof" do
  1508.       begin
  1509.         read 1 line from fh;
  1510.         print it & return;
  1511.       end;
  1512.     set the printer to off;
  1513.     close fh;
  1514.  
  1515.     The following handler prints all the page fields in a pad:
  1516.  
  1517.     handler select;
  1518.     begin
  1519.       ask "Which pad?" with currentPad();
  1520.       if it is empty then exit;
  1521.       go to pad it;
  1522.       for i = 1 to the number of pages do
  1523.         begin
  1524.           go to page i;
  1525.           for j = 1 to the number of pg flds do
  1526.             print page field j & return;
  1527.         end;
  1528.     end;
  1529.  
  1530.     -----------------------------------
  1531.     PUSH
  1532.  
  1533.     Syntax:
  1534.     push <page description>;
  1535.     push recent;
  1536.  
  1537.     Purpose: The push page command saves a page identifier on the page
  1538.     stack. The push page command remembers a page and pad so that you can
  1539.     later return there with the pop page command. You can think of this
  1540.     command as placing a bookmark at a location within a pad.
  1541.  
  1542.  
  1543.  
  1544.     ________________________________________________________________________
  1545.                                                Chapter 11: Commands   128
  1546.     ________________________________________________________________________
  1547.  
  1548.  
  1549.     The push recent syntax saves the page that you just came from on the
  1550.     page stack.  This is particularly useful for returning back there later,
  1551.     like in the following example:
  1552.  
  1553.     This handler belongs in a pad script.
  1554.  
  1555.     handler openPad;
  1556.     begin
  1557.       push recent;
  1558.       pass;
  1559.     end;
  1560.  
  1561.     When you want to return from where you came:
  1562.  
  1563.     handler select;
  1564.     begin
  1565.       pop page;
  1566.     end;
  1567.  
  1568.     When to use it:  Use the push page command when you want to remember a
  1569.     particular location within a pad so that you can later return there.
  1570.  
  1571.     Examples:
  1572.  
  1573.     The following script visits every page of a background, sending a
  1574.     message to one of its fields and then returns to the page it started
  1575.     from.
  1576.  
  1577.     handler select;
  1578.     begin
  1579.       put 0 into total;
  1580.       push this page;
  1581.       for i=1 to the number of pages of bkgnd 2 do
  1582.         begin
  1583.           go to page i of bkgnd 2;
  1584.           send "reCalc" to field "Item Cost";
  1585.           add pg fld "Item Cost" to total;
  1586.         end;
  1587.       pop page;
  1588.       answer "The total was" && total;
  1589.     end;
  1590.  
  1591.     Some other examples:
  1592.  
  1593.     push this page;
  1594.  
  1595.     push recent;
  1596.  
  1597.     push previous page;
  1598.  
  1599.     push next page;
  1600.  
  1601.  
  1602.  
  1603.     ________________________________________________________________________
  1604.                                                Chapter 11: Commands   129
  1605.     ________________________________________________________________________
  1606.  
  1607.  
  1608.     push first page;
  1609.  
  1610.     push page 2 of bkgnd 4;
  1611.  
  1612.     See Also: pop page
  1613.  
  1614.     -----------------------------------
  1615.     PUT
  1616.  
  1617.     Syntax:
  1618.     put <expression> [into <destination>];
  1619.  
  1620.     Purpose: The put command places information into a container: either a
  1621.     field, a variable, or the message box. The <expression> can be text,
  1622.     numeric, a numeric expression, or a container. The <destination> must be
  1623.     a container.
  1624.     Expressions are evaluated before they are stored in the destination. So,
  1625.     if you put an arithmetic equation, its result is placed into the
  1626.     destination.
  1627.  
  1628.     If no destination is specified the result is placed into the message
  1629.     box.
  1630.  
  1631.     The put command is probably the most often used command in PADtalk. It
  1632.     provides the only mechanism for copying data from one location to
  1633.     another.
  1634.  
  1635.     Examples:
  1636.  
  1637.     put 10 into page field 1;
  1638.  
  1639.     put longDate() into the message box;
  1640.  
  1641.     put "Wowee" after word 7 of pg fld id 8;
  1642.  
  1643.     put page field "subTotal" into page field "total";
  1644.  
  1645.     put 10 into field 1 of page 6 of background 2;
  1646.  
  1647.     put empty into me;
  1648.  
  1649.     The following two statements are the same:
  1650.  
  1651.     put "hello";
  1652.     put "hello" into the message box;
  1653.  
  1654.     The next two statements are also the same:
  1655.  
  1656.     put "hello" into it;
  1657.     get "hello";
  1658.  
  1659.     See also: get
  1660.  
  1661.  
  1662.  
  1663.     ________________________________________________________________________
  1664.                                                Chapter 11: Commands   130
  1665.     ________________________________________________________________________
  1666.  
  1667.  
  1668.     -----------------------------------
  1669.     QUERY
  1670.  
  1671.     Syntax:
  1672.     query <expression>;
  1673.     query clear;
  1674.  
  1675.     Purpose: The query command creates a subset of pages based on some
  1676.     criteria. The query command goes to each page of a particular background
  1677.     and evaluates a boolean (true or false) expression. If the expression is
  1678.     true, then the page is included in the query. If the expression is
  1679.     false, then the page is excluded from the query. A subset of the pages
  1680.     that meet the criteria is formed.
  1681.  
  1682.     The following example will include only pages that contain "John" in the
  1683.     "name" field.
  1684.  
  1685.     query field "Name" contains "John";
  1686.  
  1687.     If you want to query on a numeric field:
  1688.  
  1689.     query field "Total" > 10;
  1690.  
  1691.     The following statement shows the versatility of the query command. It
  1692.     results in a random set of about half of the pages of any background
  1693.     being included in the query.
  1694.  
  1695.     query random(2) = 1;
  1696.  
  1697.     Once the query has been established, the pad user can view only those
  1698.     pages included in the subset. Using the built-in navigation tools
  1699.     (including PGUP and PGDN), the user can move between the pages in the
  1700.     group. While a query is active, the user can also print and sort those
  1701.     pages.
  1702.  
  1703.     Although you can use PADtalk commands to access other pages in the pad,
  1704.     in order to restore the pad to its pre-query state, you must clear the
  1705.     query with the query clear command.
  1706.  
  1707.     The query will also be cleared if you perform another query, exit to
  1708.     DOS, or run another program.
  1709.  
  1710.     For larger queries, HyperPAD may be required to create a temporary file
  1711.     to hold some query information. The file will reside in the program
  1712.     directory (where HPAD.EXE is located) and will have the same name as
  1713.     your current pad but with an ".IDX" file extension.
  1714.  
  1715.     The result of the query can be determined using the result() function.
  1716.     The result() will return "found" if the query found at least one page;
  1717.     otherwise the result() will return "not found".
  1718.  
  1719.  
  1720.  
  1721.     ________________________________________________________________________
  1722.                                                Chapter 11: Commands   131
  1723.     ________________________________________________________________________
  1724.  
  1725.  
  1726.     Examples:
  1727.  
  1728.     query field 1 contains "Smith";
  1729.     if the result is "not found" then
  1730.       answer "No pages in query.";
  1731.  
  1732.     query field 1 = 3 and field 2  10;
  1733.  
  1734.     query field 1 = 3 and field 2  10 or state = "NY";
  1735.  
  1736.     See Also: find, sort
  1737.  
  1738.     -----------------------------------
  1739.     READ
  1740.  
  1741.     Syntax:
  1742.     read from <fileNumber> until end;
  1743.     read from <fileNumber> until <character>;
  1744.     read <expression> characters | items |
  1745.          words | lines from <fileNumber>;
  1746.  
  1747.     Purpose: The read command reads data from a file into the local variable
  1748.     it. You can only read from files that have been opened using the open()
  1749.     function.
  1750.  
  1751.     The syntax read from <fileNumber> until end is used to read all the
  1752.     characters that remain in the file starting at the current position in
  1753.     the file.
  1754.  
  1755.     put open("data.dat") into fh;
  1756.     read from fh until end;
  1757.     close fh;
  1758.     put it into field 1;
  1759.  
  1760.     The syntax  read from <fileNumber> until <character> is used to read all
  1761.     of the characters up to the next occurrence of character starting at the
  1762.     current position. For example:
  1763.  
  1764.     put open("data.dat") into fh;
  1765.     read from fh until "A";
  1766.     close fh;
  1767.     put it into field 1;
  1768.  
  1769.     The syntax read <expression> characters | items | words | lines from
  1770.     <fileNumber> is used to read a number of characters, words, items, of
  1771.     lines from the file into the variable it.
  1772.  
  1773.  
  1774.  
  1775.     ________________________________________________________________________
  1776.                                                Chapter 11: Commands   132
  1777.     ________________________________________________________________________
  1778.  
  1779.  
  1780.     For example:
  1781.  
  1782.     put open("data.dat") int fh;
  1783.     read 1 character from fh;
  1784.     put it;
  1785.     read 6 words from fh;
  1786.     put it;
  1787.     read 5 items from fh;
  1788.     put it;
  1789.     read 2 lines from it;
  1790.     put it;
  1791.  
  1792.     Words are surrounded by either spaces or carriage returns, items are
  1793.     determined by commas, and lines are defined by carriage returns.
  1794.  
  1795.     When reading from files, HyperPAD translates carriage return/line-feed
  1796.     pairs to single carriage returns.
  1797.  
  1798.     You can determine if you have reached the end of file using the result()
  1799.     function. If you have reached the end of file, the result() returns
  1800.     "eof". Otherwise, the result() will be empty. The end of file is
  1801.     determined by either an end of file marker (Hex 1A) or by reading the
  1802.     number of characters determined by the file size. For example:
  1803.  
  1804.     Examples:
  1805.  
  1806.     read from file_number until end;
  1807.  
  1808.     read from file_number until "@";
  1809.  
  1810.     read n+1 words from file_number;
  1811.  
  1812.     read 1 line from file_number;
  1813.  
  1814.     This example reads the AUTOEXEC.BAT file into page field 1:
  1815.  
  1816.     put the open of "C:\AUTOEXEC.BAT" into fh;
  1817.     read from fh until end;
  1818.     close fh;
  1819.     put it into page field 1;
  1820.  
  1821.     The next handler reads a text file of names and addresses into the PHONE
  1822.     pad. Each record in the text file is separated by a blank line. The
  1823.     format of the phone record in the text file is as follows:
  1824.        Name
  1825.        Phone Number
  1826.        Address
  1827.        Name
  1828.        Phone Number
  1829.        Address
  1830.  
  1831.  
  1832.  
  1833.     ________________________________________________________________________
  1834.                                                Chapter 11: Commands   133
  1835.     ________________________________________________________________________
  1836.  
  1837.  
  1838.     The address field can take up as many lines as necessary, as long as a
  1839.     blank line is understood as separating the records:
  1840.  
  1841.     handler readPhoneRecords;
  1842.     begin
  1843.       put open ("PHONE.TXT") into fh;
  1844.       repeat
  1845.         doMenu "new page";
  1846.         read 1 line from fh;
  1847.         put it into field "Name";
  1848.         read 1 line from fh;
  1849.         put it into field "Phone Number";
  1850.         read 1 line from fh;
  1851.         put empty into "Address";
  1852.         repeat
  1853.           read 1 line from fh;
  1854.           if it is not empty then
  1855.           put it after the last line of address;
  1856.         until it is empty;
  1857.         put address into field "Address";
  1858.       until the result is "eof";
  1859.       close fh;
  1860.     end;
  1861.  
  1862.     Note: The <fileNumber> parameter is a number returned by the open()
  1863.     function.
  1864.  
  1865.     See Also:  write, create(), append(), open()
  1866.  
  1867.     -----------------------------------
  1868.     RECORD
  1869.  
  1870.     Syntax:
  1871.     record <expression>;
  1872.  
  1873.     Purpose: This command records keystrokes for later playback using the
  1874.     playBack command. The number of keystrokes you can record is 100.
  1875.  
  1876.     Recorded keystrokes remain in memory when you run other programs. If
  1877.     there are any keys in the buffer when another program is launched, they
  1878.     are immediately played back when the running program is started.
  1879.  
  1880.     The <expression> contains the keystrokes that you want played back.
  1881.     Letters and punctuation are types in as normal, like:
  1882.  
  1883.     record "hello";
  1884.  
  1885.     Special keys and key combinations are placed inside brackets, like:
  1886.  
  1887.     record "{alt+f}Njunk.pad{enter}";
  1888.  
  1889.  
  1890.  
  1891.     ________________________________________________________________________
  1892.                                                Chapter 11: Commands   134
  1893.     ________________________________________________________________________
  1894.  
  1895.  
  1896.     A complete list of all of the special keys and key combinations is
  1897.     located in Appendix 2, "Key Codes". The record command will translate
  1898.     all of the keys in the <expression>  to numbers.
  1899.  
  1900.     In addition to keystrokes, there is a special command that you can place
  1901.     within brackets called pause. For example:
  1902.  
  1903.     record "{escape}{enter}{pause:5000}";
  1904.  
  1905.     The pause command waits a specified number of milliseconds before
  1906.     continuing keystroke playback. Thus, {pause:500} waits for half a
  1907.     second.
  1908.  
  1909.     When to use it:  When combined with the run command, the record and
  1910.     playback commands are particularly useful because you can pump
  1911.     keystrokes into other programs.
  1912.  
  1913.     Examples:
  1914.  
  1915.     record "this is a test";
  1916.  
  1917.     record "{alt+f}ophone{enter}";
  1918.  
  1919.     The following runs BASICA, loading a program called DEMO and running it:
  1920.  
  1921.     handler select;
  1922.     begin
  1923.      record "load ^"DEMO.BAS^"{enter}run{enter}";
  1924.      playBack;
  1925.      run "BASICA.EXE";
  1926.     end;
  1927.  
  1928.     Notes: This command sends the record message. HyperPAD handles the
  1929.     record message.
  1930.  
  1931.     See Also: playBack
  1932.  
  1933.     -----------------------------------
  1934.     RUN
  1935.  
  1936.     Syntax:
  1937.     run <program>;
  1938.     run <program> with programDirectory;
  1939.     run <program> with pause;
  1940.     run <program> with programDirectory,pause;
  1941.  
  1942.     Purpose: The run command executes other programs you use on your
  1943.     computer. While the external program is running, HyperPAD shrinks to 3K,
  1944.  
  1945.  
  1946.  
  1947.     ________________________________________________________________________
  1948.                                                Chapter 11: Commands   135
  1949.     ________________________________________________________________________
  1950.  
  1951.  
  1952.     giving the program as much memory as possible. When you exit the
  1953.     external program, HyperPAD resumes where it left off.
  1954.  
  1955.     The pause parameter causes HyperPAD to display the message
  1956.  
  1957.     Press any key to return to HyperPAD
  1958.  
  1959.     before returning to HyperPAD.  HyperPAD will resume after any keystroke
  1960.     or mouse button press.
  1961.  
  1962.     The programDirectory option controls which directory the program will be
  1963.     executed from. If specified, the current directory will be changed to
  1964.     the directory containing the program. If it is not specified, the
  1965.     current directory will remain unchanged. This parameter is used mainly
  1966.     with programs that require you run them from their own directory.
  1967.  
  1968.     When running another program, HyperPAD performs the following steps:
  1969.  
  1970.     1.  If the extension is not supplied, HyperPAD looks for .EXE, .COM, and
  1971.     .BAT files.
  1972.  
  1973.     2.  If a directory is specified with the filename, HyperPAD looks only
  1974.     in that directory for the program.
  1975.  
  1976.     3.  If no directory is specified, HyperPAD searches the following areas
  1977.     (in this order) for the program:
  1978.  
  1979.     a. The current directory.
  1980.     b. The directory specified by the environment variable HPADNET.
  1981.     c. The program directory (where HPAD.EXE is located).
  1982.     d. The startup directory (where HPAD.EXE was started from).
  1983.     e. Every directory specified in the path.
  1984.  
  1985.     You can determine the return code of the a program using the result()
  1986.     function. Normally, you can determine the return code of a program in a
  1987.     batch file using the DOS errorlevel batch command. In HyperPAD, this
  1988.     number is returned by the result() function.
  1989.  
  1990.     Examples:
  1991.  
  1992.     To return temporarily to the MS-DOS prompt:
  1993.  
  1994.     run environment("COMSPEC");
  1995.  
  1996.     To run a standard program:
  1997.  
  1998.     run "C:\123\123.EXE" with programDirectory;
  1999.  
  2000.     To run a batch file called C:\BATS\TEST.BAT:
  2001.  
  2002.     run "C:\COMMAND.COM /c C:\BATS\TEST.BAT";
  2003.  
  2004.  
  2005.  
  2006.     ________________________________________________________________________
  2007.                                                Chapter 11: Commands   136
  2008.     ________________________________________________________________________
  2009.  
  2010.  
  2011.     To run a batch file leaving room for a larger environment:
  2012.  
  2013.     run "C:\COMMAND.COM /e:2048 /c C:\BATS\TEST.BAT";
  2014.  
  2015.     To run a program and pause before it returns:
  2016.  
  2017.     run "FORMAT.COM A:" with pause;
  2018.  
  2019.     Abbreviations: programDir, progDir
  2020.  
  2021.     -----------------------------------
  2022.     SEND
  2023.  
  2024.     Syntax:
  2025.     send <message> <parameter list> to <object>
  2026.  
  2027.     Purpose: The send command sends a message, along with its parameters, to
  2028.     a specific object. It allows you to redirect a message's normal travel
  2029.     up the hierarchy to another object.
  2030.  
  2031.     When to use it: Use the send command when you want some action to be
  2032.     performed that is handled by some other object or handler.
  2033.     It can also be used to bypass a message handler in the hierarchy.
  2034.  
  2035.     Parameters: The <message> parameter is any message for which a handler
  2036.     has been defined in the hierarchy of the receiving object.  The
  2037.     characters of the message must be enclosed in double quotes, like
  2038.     "select". The optional <parameter list> is a list of  values separated
  2039.     by commas that will be used by the receiving message handler.
  2040.  
  2041.     Examples:
  2042.  
  2043.     send "select" to page button "Quit";
  2044.  
  2045.     send "keyPress" 7181 to me; -- simulate ENTER
  2046.  
  2047.     send "changeTemp" "up",5 to fld "Thermostat";
  2048.  
  2049.     The following statement avoids the other objects in the hierarchy by
  2050.     sending a message directly to HyperPAD:
  2051.  
  2052.     send "doMenu" "new page" to hyperpad;
  2053.  
  2054.     The send message will travel up the hierarchy of the receiving object.
  2055.  
  2056.  
  2057.  
  2058.     ________________________________________________________________________
  2059.                                                Chapter 11: Commands   137
  2060.     ________________________________________________________________________
  2061.  
  2062.  
  2063.     The following example sends a message to one of two routines. It either
  2064.     adds or multiplies two numbers, depending on which option the user
  2065.     wants:
  2066.  
  2067.     handler _add(n1, n2);
  2068.     begin
  2069.       put n1 + n2;
  2070.     end;
  2071.  
  2072.     handler _multiply (n1,n2);
  2073.     begin
  2074.       put n1 * n2;
  2075.     end;
  2076.  
  2077.     handler select;
  2078.     begin
  2079.       answer "add or multiply" with "add", "multiply";
  2080.       if it is not empty then
  2081.         send "_" & it 10,12 to me;
  2082.     end;
  2083.  
  2084.     Note: The send command changes the value of the me object, but does not
  2085.     change the value of target or currentObject. You can only send messages
  2086.     to objects within the current pad. If you send a message to another
  2087.     page, that page does not become the current page (i.e. it will not
  2088.     receive the openPage message). Parameter expressions are evaluated
  2089.     before the message is sent.
  2090.  
  2091.     -----------------------------------
  2092.     SET
  2093.  
  2094.     Syntax:
  2095.     set [the] <property> [of <object>] to <value>;
  2096.  
  2097.     Purpose: The set command establishes property values of the objects in
  2098.     your pads. With set, you can modify properties affecting buttons,
  2099.     fields, pages, backgrounds, pads, the message box, the menu bar, the
  2100.     status bar and the tool box.
  2101.  
  2102.     The properties that you can set for the different objects are described
  2103.     in Chapter Twelve, "Properties".
  2104.  
  2105.     Examples:
  2106.  
  2107.     set hilite of page button 1 to true;
  2108.  
  2109.     set lockScreen to false;
  2110.  
  2111.     set the color of page field 4 to black on white;
  2112.  
  2113.  
  2114.  
  2115.     ________________________________________________________________________
  2116.                                                Chapter 11: Commands   138
  2117.     ________________________________________________________________________
  2118.  
  2119.  
  2120.     -----------------------------------
  2121.     SETDEFAULTPOPUPCOLOR
  2122.  
  2123.     Syntax:
  2124.     setDefaultPopupColor;
  2125.  
  2126.     Purpose: This handler resets the colors of the popup menus to the same
  2127.     values that HyperPAD uses to display the pull down menus. These colors
  2128.     are modified depending on your computer's graphics card and the command
  2129.     line parameters /mono, /lcd, /B&W, and /color.
  2130.  
  2131.     See Also: popup(), setPopupColors
  2132.  
  2133.     -----------------------------------
  2134.     SETPOPUPCOLORS
  2135.  
  2136.     Syntax:
  2137.     setPopupColors <menu color>,<highlight color>,
  2138.       <letter color>,<dimmed color>;
  2139.  
  2140.     Purpose: This handler sets the display colors for future popup menus.
  2141.     The colors are used as follows:
  2142.  
  2143.     Color:             Description:
  2144.     ----------------------------------------------------
  2145.     Menu color         The color of the menu, including the border
  2146.  
  2147.     Highlight color    The color of a highlighted choice
  2148.  
  2149.     Letter color       The color of the accelerator characters of the
  2150.                        choices (specified with the & within the choice)
  2151.  
  2152.     Dimmed color       The color of dimmed choices (specified with the @
  2153.                        character within the choice)
  2154.  
  2155.     Examples:
  2156.  
  2157.     setPopupColors 31,112,27,123;
  2158.  
  2159.     setPopupColors light green,black on grey,red,light grey;
  2160.  
  2161.     See Also: popup(), setDefaultPopupColors
  2162.  
  2163.  
  2164.  
  2165.     ________________________________________________________________________
  2166.                                                Chapter 11: Commands   139
  2167.     ________________________________________________________________________
  2168.  
  2169.  
  2170.     -----------------------------------
  2171.     SHOW
  2172.  
  2173.     Syntax:
  2174.     show <object>;
  2175.  
  2176.     Purpose: The show command makes the specified button or field visible;
  2177.     this is the same as setting the visible property of the object to true.
  2178.  
  2179.     When to use it:  If you want a button or field to become visible only if
  2180.     certain criteria are met.
  2181.  
  2182.     Examples:
  2183.  
  2184.     show page button 3;
  2185.  
  2186.     show page field 7;
  2187.  
  2188.     The following two statements are equivalent:
  2189.  
  2190.     show button 1;
  2191.  
  2192.     set the visible of button 1 to true;
  2193.  
  2194.     See Also: hide, visible
  2195.  
  2196.     -----------------------------------
  2197.     SORT
  2198.  
  2199.     Syntax:
  2200.     sort [ascending | descending] [text | numeric | date]
  2201.       by <expression>;
  2202.  
  2203.     Purpose: The sort command reorders the pages belonging to a background
  2204.     according to a specified condition.
  2205.  
  2206.     The sort command works by cycling though all the pages of a particular
  2207.     background and evaluating an expression. The result of the expression is
  2208.     saved and used as a sort key. Once all of the sort information has been
  2209.     gathered, the pages are sorted in the specified order.
  2210.  
  2211.     For example, the following statement sorts a pad by the first background
  2212.     field:
  2213.  
  2214.     sort by field 1;
  2215.  
  2216.     For each page in the current background, the expression field 1 is
  2217.     evaluated and used as sort criteria. Suppose that there are 5 pages in
  2218.     this pad, each using the same background.
  2219.  
  2220.  
  2221.  
  2222.     ________________________________________________________________________
  2223.                                                Chapter 11: Commands   140
  2224.     ________________________________________________________________________
  2225.  
  2226.  
  2227.     After sort has cycled through all of the pages and evaluated the
  2228.     expression, the situation is as follows:
  2229.  
  2230.     at page 1, field 1 = "Sue"
  2231.     at page 2, field 1 = "John"
  2232.     at page 3, field 1 = "Zev"
  2233.     at page 4, field 1 = "Lisa"
  2234.     at page 5, field 1 = "Jim"
  2235.  
  2236.     After sorting, the pages will be reordered as follows:
  2237.  
  2238.     page 5 will become page 1  ("Jim")
  2239.     page 2 will become page 2  ("John")
  2240.     page 4 will become page 3  ("Lisa")
  2241.     page 1 will become page 4  ("Sue")
  2242.     page 3 will become page 5  ("Zev")
  2243.  
  2244.     When there are multiple backgrounds in the pad, sort may appear to give
  2245.     incorrect results because pages in the pad that use different
  2246.     backgrounds will remain in their same positions. For example, suppose we
  2247.     have 7 pages, 5 pages using background 1 and 2 pages using background 2.
  2248.     We perform the same sort on the first page of background 1:
  2249.  
  2250.     page 1, background 1, field 1 = "Sue"
  2251.     page 2, background 2
  2252.     page 3, background 1, field 1 = "John"
  2253.     page 4, background 1, field 1 = "Zev"
  2254.     page 5, background 2
  2255.     page 6, background 1, field 1 = "Lisa"
  2256.     page 7, background 1, field 1 = "Jim"
  2257.  
  2258.     After sorting, the pad will be organized as follows (notice that the
  2259.     pages of background 2 remained in their relative positions in the pad):
  2260.  
  2261.     page 7, background 1  ("Jim")
  2262.     page 2, background 2
  2263.     page 3, background 1  ("John")
  2264.     page 6, background 1  ("Lisa")
  2265.     page 5, background 2
  2266.     page 1, background 1  ("Sue")
  2267.     page 4, background 1  ("Zev")
  2268.  
  2269.     The sort command treats the data differently if you specify text,
  2270.     numeric, or date. For text data, HyperPAD alphabetizes the data. For
  2271.     numeric data, HyperPAD compares numeric quantities. For dates, HyperPAD
  2272.     compares the data as dates (dates can be represented using any format
  2273.     the convert command recognizes).
  2274.  
  2275.  
  2276.  
  2277.     ________________________________________________________________________
  2278.                                                Chapter 11: Commands   141
  2279.     ________________________________________________________________________
  2280.  
  2281.  
  2282.     The optional parameter ascending (the default) specifies that you want
  2283.     the data sorted with the lowest values near the front; descending
  2284.     specifies the opposite.
  2285.  
  2286.     For larger sorts, a disk file may be required to hold temporary sorting
  2287.     data. In such a case, HyperPAD creates a temporary file in either the
  2288.     directory specified by the TMP environment variable, or if TMP is not
  2289.     specified, in the directory from which you launched HyperPAD.
  2290.  
  2291.     To make sorting faster, therefore, you can have TMP specify a directory
  2292.     on a RAM disk, as in the following DOS command:
  2293.  
  2294.     SET TMP=D:\
  2295.  
  2296.     Examples:
  2297.  
  2298.     sort descending by field "name";
  2299.  
  2300.     sort by the last word of field "name";
  2301.  
  2302.     sort numeric by field "age";
  2303.  
  2304.     sort ascending date by field "birthday";
  2305.  
  2306.     See Also: query, find
  2307.  
  2308.     -----------------------------------
  2309.     SOUND
  2310.  
  2311.     Syntax:
  2312.     sound <frequency>;
  2313.  
  2314.     Purpose: The sound command turns the speaker on at a given frequency.
  2315.  
  2316.     The sound will remain on until you turn it off using the noSound
  2317.     command.
  2318.  
  2319.     Examples:
  2320.  
  2321.     sound 2000;
  2322.     wait 500;  -- half a second
  2323.     noSound;
  2324.  
  2325.     Notes: This command sends the sound message. When the handler reaches
  2326.     HyperPAD, the sound handler is executed.
  2327.  
  2328.  
  2329.  
  2330.     ________________________________________________________________________
  2331.                                                Chapter 11: Commands   142
  2332.     ________________________________________________________________________
  2333.  
  2334.  
  2335.     -----------------------------------
  2336.     SUBTRACT
  2337.  
  2338.     Syntax:
  2339.     subtract <expression> from <destination>;
  2340.  
  2341.     Purpose: The subtract command subtracts the value of the expression from
  2342.     the value of the destination and places the result into the destination.
  2343.     The <expression> must be a number or a container holding a number. The
  2344.     <destination> must be a container.
  2345.  
  2346.     Note:  You will receive a runtime error if the <expression> and
  2347.     <destination> are not both numbers.
  2348.  
  2349.     Examples:
  2350.  
  2351.     subtract 5 from page field 23;
  2352.  
  2353.     -----------------------------------
  2354.     VISUAL
  2355.  
  2356.     Syntax:
  2357.     visual [effect] <effectName> [<direction>]
  2358.       [with delay <expression>];
  2359.  
  2360.     Purpose: The visual command sets up an effect to be used during the next
  2361.     page or pad change. Instead of simply replacing one page with another
  2362.     (which is the default) you can select an effect which alters the manner
  2363.     in which a page is placed on-screen.
  2364.  
  2365.     Once the effect has been executed, it is reset to the replace effect
  2366.     (the default). So, you must specify an effect each time you want it to
  2367.     occur.
  2368.  
  2369.     The following list includes all the effects and their usable directions:
  2370.  
  2371.     Effect:        Direction:
  2372.     ----------------------------------------------------------
  2373.     box            in, out
  2374.  
  2375.     drip           none
  2376.  
  2377.     fade           none
  2378.  
  2379.     hsplit         in, out
  2380.  
  2381.     peel           upperleft, lowerleft, upperright, lowerright
  2382.  
  2383.     quad           none
  2384.  
  2385.     replace        none
  2386.  
  2387.  
  2388.  
  2389.     ________________________________________________________________________
  2390.                                                Chapter 11: Commands   143
  2391.     ________________________________________________________________________
  2392.  
  2393.  
  2394.     When to use it: Visual effects are useful if you want to capture your
  2395.     audience's attention without distracting them from the information
  2396.     you're relating.
  2397.  
  2398.     Examples:
  2399.  
  2400.     The following example goes to the next or previous page depending on
  2401.     whether the SHIFT key is depressed when the button was selected. It uses
  2402.     an appropriate visual direction as a user feedback device.
  2403.  
  2404.     handler select;
  2405.     begin
  2406.       if the shiftKey is "down" then
  2407.         begin
  2408.           visual effect scroll down;
  2409.           go to the previous page;
  2410.         end
  2411.       else
  2412.         begin
  2413.           visual effect scroll up;
  2414.           go to the next page;
  2415.         end
  2416.     end;
  2417.  
  2418.     Comments: The visual effect is set to replace when the next idle message
  2419.     is sent (upon completion of all pending handlers).
  2420.  
  2421.     -----------------------------------
  2422.     WAIT
  2423.  
  2424.     Syntax:
  2425.     wait <milliseconds>;
  2426.  
  2427.     Purpose: This command waits a specified number of milliseconds. Pressing
  2428.     CTRL+BREAK will terminate the wait command and stop execution of the
  2429.     script.
  2430.  
  2431.     The delay is the same for all computers. HyperPAD uses either the real
  2432.     time clock (on AT style computers) or the system clock (interrupt 8) so
  2433.     that it ticks 1000 times per second.
  2434.  
  2435.     Examples:
  2436.  
  2437.     wait 5000;     -- 5 seconds
  2438.  
  2439.     wait i * 1000; -- if i = seconds
  2440.  
  2441.  
  2442.  
  2443.     ________________________________________________________________________
  2444.                                                Chapter 11: Commands   144
  2445.     ________________________________________________________________________
  2446.  
  2447.  
  2448.     -----------------------------------
  2449.     WRITE
  2450.  
  2451.     Syntax:
  2452.     write <expression> to <fileNumber>;
  2453.  
  2454.     Purpose: The write command adds data to an open file. Only files opened
  2455.     with the append() or create() function can be used with this command.
  2456.  
  2457.     Examples:
  2458.  
  2459.     To write a field to a file:
  2460.  
  2461.     put create("data.dat") into fh;
  2462.     write page field 1 to fh;
  2463.     close fh;
  2464.     Use the return constant to end a line:
  2465.  
  2466.     write page field "name" & return to fh;
  2467.     write page field "address" & return to fh;
  2468.     write page field "phone number" & return & return to fh;
  2469.  
  2470.     Note: Single carriage returns are translated to carriage return/line-
  2471.     feed pairs. All files are automatically closed when the user exits or
  2472.     runs another application using the run command.
  2473.